package com.atguigu.srb.core.controller.admin;

import com.atguigu.srb.common.result.Result;
import com.atguigu.srb.core.pojo.entity.UserLoginRecord;
import com.atguigu.srb.core.service.UserLoginRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * ClassName: AdminUserLoginRecordController
 * Package: com.atguigu.srb.core.controller.admin
 * Description:
 *
 * @Author 王晓龙
 * @Create 2023/4/3 20:49
 * @Version 1.0
 */
@RestController
@Api("展示会员登陆日志")
@RequestMapping("/admin/core/userLoginRecord")
//@CrossOrigin
public class AdminUserLoginRecordController {
    @Resource
    UserLoginRecordService userLoginRecordService;

    @ApiOperation("显示会员登录日志")
    @GetMapping("/loginRecord/{userId}")
    public Result getLoginRecord(
            @PathVariable String userId
    ){
        List<UserLoginRecord> list =  userLoginRecordService.getLoginRecordList(userId);
        return Result.ok().data("list", list);
    }
}